package net.hn.hnms.biz.blueprint.domain;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.ArrayTypeHandler;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * @author wangjingrui
 * @date 2022/9/14 16:36
 */
@Data
@NoArgsConstructor
@ExcelIgnoreUnannotated
@EqualsAndHashCode(callSuper = false)
@TableName(value = "file_catalog", autoResultMap = true)
public class Catalog extends BaseModel {

    @ApiModelProperty(value = "主键ID")
    @TableId(type = IdType.ASSIGN_UUID)
    private String catalogId;

    @TableField(updateStrategy = FieldStrategy.IGNORED)
    @ApiModelProperty(value = "父级id")
    @Length(max = 255, message = "父级id长度不能超过255个字符")
    private String parentId;

    @TableField(updateStrategy = FieldStrategy.IGNORED)
    @ApiModelProperty(value = "祖级列表")
    @Length(max = 255, message = "祖级列表长度不能超过255个字符")
    private String ancestors;

    @ApiModelProperty(value = "目录名称")
    @Length(max = 16, message = "目录名称长度不能超过16个字符")
    @NotBlank(message = "目录名称不能为空")
    private String catalogName;

    @ApiModelProperty(value = "文件ossIds")
    @TableField(typeHandler= ArrayTypeHandler.class)
    private Long[] ossIds;

    @ApiModelProperty(value = "组织结构Id")
    @TableField(typeHandler= ArrayTypeHandler.class)
    private Long[] orgIds;

    @ApiModelProperty(value = "用户Id")
    @TableField(typeHandler= ArrayTypeHandler.class)
    private Long[] userIds;
}
